package cn.zn.quartz.config;

import cn.zn.base.properties.ZnAdminProperties;
import cn.zn.quartz.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ApplicationRunnerImpl implements ApplicationRunner {

    @Autowired
    private JobService jobService;

    @Autowired
    private ZnAdminProperties znAdminProperties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        if (!znAdminProperties.getDevModel()) {
            jobService.initJobs();
        }
    }

}
